home *** CD-ROM | disk | FTP | other *** search
- From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
- Date: Tue, 4 Jan 94 10:31:36 +0100
- Message-Id: <9401040931.AA24042@issan.informatik.uni-dortmund.de>
- To: mint@atari.archive.umich.edu
- In-Reply-To: <199401030933.AA14748@techfac.TechFak.Uni-Bielefeld.DE> (message from Torsten Scherer on Mon, 3 Jan 94 0:29:54 +0100)
- Subject: Re: strange Fselect/Finstat behaviour...
-
- This is how i'm interpreting the situation: The keyboard is checked
- periodically for the control characters as defined by the tty
- settings. Without MiNT, ^C/^S/^Q is only checked when a program
- explicitly reads a character in non-raw mode. To maintain
- compatibility with old programs which uses Crawcin when they don't
- want to be killed, there is a flag in the tty settings (TS_COOKED) to
- record how the terminal was last read. If it was last read using RAW
- mode, the check for control characters is effectively disabled, and it
- is enabled again when reading in COOKED mode. The problem is that you
- don't know how a non-mint-aware program wants to handle ^C/^S until it
- actually reads the terminal.
-
- Now when using Fread() on a terminal that is set via ioctl() to RAW
- mode, the TS_COOKED flag is cleared before any character arrives
- (unless you're typing fast enough). On the other hand, when using
- Finstat() or Fselect(), the control character arrives before the
- terminal is read, and the state reflects the setting of the terminal
- at the time the last character was read.
-
- Try the patch below: if the terminal is configured with TIOCSETP, the
- flag TS_COOKED will now be updated immediately, under the assumption
- that a program that uses Fcntl() should be able to handle keyboard
- signals gracefully. This will slightly change the effect of ^C/^S
- when a non-mint-aware program is started after a mint-aware program
- that reads the terminal in RAW mode.
-
- --- orig/tty.c Fri Jun 25 22:24:58 1993
- +++ tty.c Mon Jan 3 20:01:16 1994
- @@ -483,6 +483,11 @@
- case TIOCSETP:
- sg = (struct sgttyb *)arg;
- tty->sg = *sg;
- + /* set the tty state for checking control characters */
- + if (sg->sg_flags & T_RAW)
- + tty->state &= ~TS_COOKED;
- + else
- + tty->state |= TS_COOKED;
- /* set baud rates */
- baud = tosbaud(sg->sg_ispeed);
- (*f->dev->ioctl)(f, TIOCIBAUD, &baud);
-